All Questions
3 questions
-1votes
1answer
574views
GO - How to define methods of named type?
In GO, rule is, methods can be defined only on named type and pointer to named type. In C, below code, operations are defined on type(say List), typedef struct List List; //list.h typedef struct { ...
5votes
2answers
4kviews
Type safety - GO vs C pointers
C is a static-typed language that is not type-safe, because pointers(void *y) let you do pretty much anything you like, even things that will crash your program. GO is also a static typed language ...
3votes
1answer
130views
Why are pointers of structs not printed like pointers of variables? [closed]
Consider the following code: package main import "fmt" type Vertex struct { X, Y int } var ( i = 10 p = &i v = Vertex{1,2} q = &v ) func main() { fmt.Println(p) // ...